﻿using UnityEngine;
using System.Collections;

public class LookAtTarget : MonoBehaviour {
	[SerializeField] Transform target;
	[SerializeField] bool lookOpposite = false;
	void Start(){
		if (target == null) {
			target = Camera.main.transform;
		}
	}
	void Update () {
		if (lookOpposite) {
			transform.LookAt (transform.position + transform.position - target.position);
		} else {
			transform.LookAt (target);
		}
	}
}
